<?php
/*
 * Copyright (C) 2010 TopCoder Inc., All Rights Reserved.
 */
namespace protocol\translation\framework\services;

require_once('PHPUnit/Framework.php');
require_once('protocol/translation/framework/services/ConversionException.php');

/**
 * <p>
 * Unit tests for the ConversionException class.
 * </p>
 *
 * @author akinwale
 * @version 1.0
 */
class ConversionExceptionTests extends \PHPUnit_Framework_TestCase {
    /**
     * <p>
     * The ConversionException instance to be tested.
     * </p>
     *
     * @var ConversionException
     */
    private $exception;

    /**
     * <p>
     * Tests that the __construct(string, int, mixed) method creates a new instance that
     * is not null.
     * </p>
     */
    public function testCtor() {
        $message = "Exception message";
        $code = 1;
        $cause = new \Exception();

        $this->exception = new ConversionException($message, $code, $cause);
        $this->assertNotNull($this->exception, "exception should not be null");
        $error = "exception not properly initialized";
        $this->assertEquals($message, $this->exception->getMessage(), $error);
        $this->assertEquals($code, $this->exception->getCode(), $error);
        $this->assertEquals($cause, $this->exception->getPrevious(), $error);
    }
}

?>